#!/sbin/openrc-run
supervisor=supervise-daemon

name="mautrix-whatsapp"
description="Daemon for Mautrix-Whatsapp, a Matrix-WhatsApp puppeting bridge"

: ${config:="/etc/mautrix-whatsapp/config.yaml"}
: ${command_user:="mautrix-whatsapp:mautrix-whatsapp"}

command="/usr/bin/mautrix-whatsapp"
command_args="-c $config $command_args"

depends() {
	need net
}

start_pre() {
	checkpath --file --owner "$command_user" /etc/mautrix-whatsapp/config.yaml
	checkpath --file --owner "$command_user" /etc/mautrix-whatsapp/registration.yaml
	checkpath --directory --owner "$command_user" /var/log/mautrix-whatsapp
}
